﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Data;
using System.Data.SqlClient;
using QLCONGNOLIBS.Securities;
using QLCONGNOLIBS.Models.EntityFW;

namespace QLCONGNOLIBS.Models
{
    public class EmployeeModels : BaseModels<IEmployee>
    {             
        private const string GET_EMPLOYEE = "SP_GET_EMPLOYEE";

        public EmployeeModels(SqlConnection objConnection, SecurityEntity objSecurity)
                    : base(objConnection, objSecurity){ }

        protected internal override DataTable GetElements()
        {
            DataTable objTable = new DataTable();
            try
            {
                m_objCommand = new SqlCommand(GET_EMPLOYEE, m_objConnection);
                m_objCommand.CommandType = CommandType.StoredProcedure;
                m_objAdapter = new SqlDataAdapter(m_objCommand);
                m_objAdapter.Fill(objTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return objTable;
        }       
    }
}
